module.exports = app => {
    const { INTEGER, STRING, DATE } = app.Sequelize;
    const User = app.model.define('user', {
        id: {
            type: INTEGER(50),
            primaryKey: true,
            allowNull: false,
            field: 'user_id',
        },
        userId: {
            type: STRING(50),
            allowNull: false,
            field: 'user_id',
        },
        passWord: {
            type: STRING(50),
            allowNull: false,
            field: 'user_password',
        },
        userPhone: {
            type: INTEGER(50),
            allowNull: true,
            field: 'user_phone',
        },
    }, {
        timestamps: true,
        paranoid: false,
        underscored: true,
        freezeTableName: true,
        getterMethods: {
            created_at() {
                return this.getDataValue('created_at') && this.getDataValue('created_at').toLocaleString();
            },
            updated_at() {
                return this.getDataValue('updated_at') && this.getDataValue('updated_at').toLocaleString();
            }
        },
    });

    return User;
}